#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n50_jalr_test)
    .set noreorder
    addiu s0, s0 ,1
    li  s2, 0x0
###test inst
    TEST_JALR(0x6e6b362a, 0x240baf26, 0x6e6b362a, 0x240baf26)
    TEST_JALR(0x5d0fcbc0, 0xdba3ac64, 0x5d0fcbc0, 0xdba3ac64)
    TEST_JALR(0xa832bb00, 0xf43fa620, 0xa832bb00, 0xf43fa620)
    TEST_JALR(0x1e2aa5ca, 0x4782fd22, 0x1e2aa5ca, 0x4782fd22)
    TEST_JALR(0x188e3538, 0x278b5208, 0x188e3538, 0x278b5208)
    TEST_JALR(0xe03fef90, 0xd294c6c0, 0xe03fef90, 0xd294c6c0)
    TEST_JALR(0x23a49840, 0xd0677a68, 0x23a49840, 0xd0677a68)
    TEST_JALR(0x55781794, 0xaf213480, 0x55781794, 0xaf213480)
    TEST_JALR(0x78d976ca, 0x0f5c7b6e, 0x78d976ca, 0x0f5c7b6e)
    TEST_JALR(0x41be8dfc, 0xea0d3954, 0x41be8dfc, 0xea0d3954)
    TEST_JALR(0x5975ddea, 0x191bfc2c, 0x5975ddea, 0x191bfc2c)
    TEST_JALR(0x2af93360, 0x6d4ed976, 0x2af93360, 0x6d4ed976)
    TEST_JALR(0x8b28908c, 0x2506cdf6, 0x8b28908c, 0x2506cdf6)
    TEST_JALR(0xb880f72b, 0x78b65ab0, 0xb880f72b, 0x78b65ab0)
    TEST_JALR(0x9abc2fae, 0x1fccc210, 0x9abc2fae, 0x1fccc210)
    TEST_JALR(0x468ca120, 0x63a8cd28, 0x468ca120, 0x63a8cd28)
    TEST_JALR(0xbd5f8d6a, 0x9ccc5a00, 0xbd5f8d6a, 0x9ccc5a00)
    TEST_JALR(0x5ff33ad0, 0x8d633be8, 0x5ff33ad0, 0x8d633be8)
    TEST_JALR(0x8af04fe8, 0x3eaf5ed6, 0x8af04fe8, 0x3eaf5ed6)
    TEST_JALR(0xe39249c6, 0xadcd7888, 0xe39249c6, 0xadcd7888)
    TEST_JALR(0xe40ada2a, 0x10857a80, 0xe40ada2a, 0x10857a80)
    TEST_JALR(0x5e3be25a, 0x147f379c, 0x5e3be25a, 0x147f379c)
    TEST_JALR(0x411bd014, 0xcbdb91f0, 0x411bd014, 0xcbdb91f0)
    TEST_JALR(0x8bf66f88, 0x9c01e678, 0x8bf66f88, 0x9c01e678)
    TEST_JALR(0xd2dbe41e, 0xc555e593, 0xd2dbe41e, 0xc555e593)
    TEST_JALR(0x4a63d80f, 0x0be2df78, 0x4a63d80f, 0x0be2df78)
    TEST_JALR(0x349af1fb, 0xada05010, 0x349af1fb, 0xada05010)
    TEST_JALR(0x30ed73d0, 0xf43185b8, 0x30ed73d0, 0xf43185b8)
    TEST_JALR(0x5488c147, 0xef423493, 0x5488c147, 0xef423493)
    TEST_JALR(0x280dcfb0, 0x654b02dc, 0x280dcfb0, 0x654b02dc)
    TEST_JALR(0x0ac92d20, 0x704bae70, 0x0ac92d20, 0x704bae70)
    TEST_JALR(0x1ef22360, 0x73a8e5f8, 0x1ef22360, 0x73a8e5f8)
    TEST_JALR(0xcbdecc5e, 0x2ad31d30, 0xcbdecc5e, 0x2ad31d30)
    TEST_JALR(0xcd0c7478, 0xbe1a2679, 0xcd0c7478, 0xbe1a2679)
    TEST_JALR(0xb22dbf3a, 0x6a759f80, 0xb22dbf3a, 0x6a759f80)
    TEST_JALR(0x92128c02, 0x5c00f61b, 0x92128c02, 0x5c00f61b)
    TEST_JALR(0x9f65ad30, 0x9df7b834, 0x9f65ad30, 0x9df7b834)
    TEST_JALR(0x51c488e0, 0xf5d6fc20, 0x51c488e0, 0xf5d6fc20)
    TEST_JALR(0x9f5501c0, 0xd3e31474, 0x9f5501c0, 0xd3e31474)
    TEST_JALR(0x536de97e, 0xc2bbd95c, 0x536de97e, 0xc2bbd95c)
    TEST_JALR(0xe61be653, 0xb66cd180, 0xe61be653, 0xb66cd180)
    TEST_JALR(0x06ed93e0, 0x8013cb46, 0x06ed93e0, 0x8013cb46)
    TEST_JALR(0x4db2624a, 0x882aa40a, 0x4db2624a, 0x882aa40a)
    TEST_JALR(0x9c18c981, 0xd46b0540, 0x9c18c981, 0xd46b0540)
    TEST_JALR(0x20362ea8, 0xdda4e301, 0x20362ea8, 0xdda4e301)
    TEST_JALR(0xbd4eb617, 0xd58664c0, 0xbd4eb617, 0xd58664c0)
    TEST_JALR(0x1b5548ff, 0xf3cd5356, 0x1b5548ff, 0xf3cd5356)
    TEST_JALR(0x268dcc90, 0xfb3b87a0, 0x268dcc90, 0xfb3b87a0)
    TEST_JALR(0xdac49479, 0xba036d18, 0xdac49479, 0xba036d18)
    TEST_JALR(0x35b58838, 0x84ddd8a0, 0x35b58838, 0x84ddd8a0)
    TEST_JALR(0x731a8e00, 0xf885d33c, 0x731a8e00, 0xf885d33c)
    TEST_JALR(0xa5d367b4, 0x5aa82d10, 0xa5d367b4, 0x5aa82d10)
    TEST_JALR(0x9b23b0f0, 0x1a1b9780, 0x9b23b0f0, 0x1a1b9780)
    TEST_JALR(0xa631c6e6, 0xc01e5184, 0xa631c6e6, 0xc01e5184)
    TEST_JALR(0xcf0350d0, 0x52e0a720, 0xcf0350d0, 0x52e0a720)
    TEST_JALR(0x3a508bf0, 0x1dc1acf7, 0x3a508bf0, 0x1dc1acf7)
    TEST_JALR(0x5343dc05, 0xb235ce3d, 0x5343dc05, 0xb235ce3d)
    TEST_JALR(0xbb96b500, 0xa62bf360, 0xbb96b500, 0xa62bf360)
    TEST_JALR(0x3a4ceaac, 0x0236e7f0, 0x3a4ceaac, 0x0236e7f0)
    TEST_JALR(0x2a6da2ec, 0x8ca27828, 0x2a6da2ec, 0x8ca27828)
    TEST_JALR(0xdd11c93c, 0x008c5880, 0xdd11c93c, 0x008c5880)
    TEST_JALR(0x514f1f08, 0x912fa124, 0x514f1f08, 0x912fa124)
    TEST_JALR(0xd137f020, 0x5028a644, 0xd137f020, 0x5028a644)
    TEST_JALR(0xd2274400, 0xbab4fdb0, 0xd2274400, 0xbab4fdb0)
    TEST_JALR(0x1c78ea70, 0xff1c183c, 0x1c78ea70, 0xff1c183c)
    TEST_JALR(0x49a7b38c, 0x2dd52c00, 0x49a7b38c, 0x2dd52c00)
    TEST_JALR(0xeec80e06, 0x4c46dc50, 0xeec80e06, 0x4c46dc50)
    TEST_JALR(0x99f515c6, 0x0ac4da04, 0x99f515c6, 0x0ac4da04)
    TEST_JALR(0xaf18a348, 0xe9342d00, 0xaf18a348, 0xe9342d00)
    TEST_JALR(0x9f2ff980, 0xce65a118, 0x9f2ff980, 0xce65a118)
    TEST_JALR(0x3cbf7f40, 0xcb5d4589, 0x3cbf7f40, 0xcb5d4589)
    TEST_JALR(0x563a1054, 0x776a3d12, 0x563a1054, 0x776a3d12)
    TEST_JALR(0x199a5570, 0x7ce1721b, 0x199a5570, 0x7ce1721b)
    TEST_JALR(0x61aa3900, 0x416ddfc7, 0x61aa3900, 0x416ddfc7)
    TEST_JALR(0xaf13ac90, 0x23fff7b0, 0xaf13ac90, 0x23fff7b0)
    TEST_JALR(0xdeafbdfb, 0xb227d4a0, 0xdeafbdfb, 0xb227d4a0)
    TEST_JALR(0xa66f3a2a, 0x0cf9c0d4, 0xa66f3a2a, 0x0cf9c0d4)
    TEST_JALR(0x982c51e8, 0xf35905fe, 0x982c51e8, 0xf35905fe)
    TEST_JALR(0x78dc5240, 0x99cece05, 0x78dc5240, 0x99cece05)
    TEST_JALR(0x27aa9988, 0x63bd2180, 0x27aa9988, 0x63bd2180)
    TEST_JALR(0x98c55e18, 0x4c8a23cc, 0x98c55e18, 0x4c8a23cc)
    TEST_JALR(0x0864e8d8, 0xefa3c11f, 0x0864e8d8, 0xefa3c11f)
    TEST_JALR(0xa0129080, 0xf8be2c38, 0xa0129080, 0xf8be2c38)
    TEST_JALR(0x7fe9274c, 0x7805ef1c, 0x7fe9274c, 0x7805ef1c)
    TEST_JALR(0xf8573c00, 0x8d9a6b22, 0xf8573c00, 0x8d9a6b22)
    TEST_JALR(0x6d211770, 0x93e4396a, 0x6d211770, 0x93e4396a)
    TEST_JALR(0x8a543f20, 0x2e5da834, 0x8a543f20, 0x2e5da834)
    TEST_JALR(0xba56e260, 0x0fe2487a, 0xba56e260, 0x0fe2487a)
    TEST_JALR(0x3c6a2b4a, 0x1857965a, 0x3c6a2b4a, 0x1857965a)
    TEST_JALR(0x0d291e8b, 0x00507018, 0x0d291e8b, 0x00507018)
    TEST_JALR(0xcffd4000, 0xc0fec614, 0xcffd4000, 0xc0fec614)
    TEST_JALR(0x257f9580, 0x51b601dc, 0x257f9580, 0x51b601dc)
    TEST_JALR(0xe3efb2e4, 0x3ece2a1e, 0xe3efb2e4, 0x3ece2a1e)
    TEST_JALR(0x6c5fa775, 0xea5deeac, 0x6c5fa775, 0xea5deeac)
    TEST_JALR(0xa22f61a0, 0x61887758, 0xa22f61a0, 0x61887758)
    TEST_JALR(0x69cd9484, 0x7d39cf3c, 0x69cd9484, 0x7d39cf3c)
    TEST_JALR(0x95a3f330, 0x61db5f48, 0x95a3f330, 0x61db5f48)
    TEST_JALR(0x04359d84, 0xa0f4fb5f, 0x04359d84, 0xa0f4fb5f)
    TEST_JALR(0x4bb028b2, 0x3bffa5ec, 0x4bb028b2, 0x3bffa5ec)
    TEST_JALR(0xe2b0a2c0, 0xf2255610, 0xe2b0a2c0, 0xf2255610)
    TEST_JALR(0xa794d358, 0xdd1bda33, 0xa794d358, 0xdd1bda33)
    TEST_JALR(0xb7ffa000, 0xd9b9d158, 0xb7ffa000, 0xd9b9d158)
    TEST_JALR(0x308a97a0, 0x2ea884ea, 0x308a97a0, 0x2ea884ea)
    TEST_JALR(0xc2aafe00, 0xcba8aeda, 0xc2aafe00, 0xcba8aeda)
    TEST_JALR(0x0c235ca6, 0x08dad9f0, 0x0c235ca6, 0x08dad9f0)
    TEST_JALR(0x002758af, 0x4f2295d4, 0x002758af, 0x4f2295d4)
    TEST_JALR(0xcb1c7cd3, 0xf1c19a19, 0xcb1c7cd3, 0xf1c19a19)
    TEST_JALR(0x0503f3ca, 0xc5a0d14e, 0x0503f3ca, 0xc5a0d14e)
    TEST_JALR(0xea7ea380, 0xf200d2c8, 0xea7ea380, 0xf200d2c8)
    TEST_JALR(0xb35aa088, 0x9b4c1034, 0xb35aa088, 0x9b4c1034)
    TEST_JALR(0x524cf520, 0x6066b320, 0x524cf520, 0x6066b320)
    TEST_JALR(0x9300ed06, 0x17d08cb4, 0x9300ed06, 0x17d08cb4)
    TEST_JALR(0x6686ce3c, 0xa49ace88, 0x6686ce3c, 0xa49ace88)
    TEST_JALR(0x6499fc7a, 0xaf671f66, 0x6499fc7a, 0xaf671f66)
    TEST_JALR(0xd7f63668, 0x85063ab8, 0xd7f63668, 0x85063ab8)
    TEST_JALR(0x1cb4afc0, 0x66cc792c, 0x1cb4afc0, 0x66cc792c)
    TEST_JALR(0x60fa0e0a, 0xd8706ed8, 0x60fa0e0a, 0xd8706ed8)
    TEST_JALR(0x00c17a40, 0xbe7d2bc0, 0x00c17a40, 0xbe7d2bc0)
    TEST_JALR(0x9afa9d98, 0x980b0c54, 0x9afa9d98, 0x980b0c54)
    TEST_JALR(0xce0be588, 0xe44b84f2, 0xce0be588, 0xe44b84f2)
    TEST_JALR(0x797079e4, 0x8fbfb80d, 0x797079e4, 0x8fbfb80d)
    TEST_JALR(0x116f4350, 0xe8afc208, 0x116f4350, 0xe8afc208)
    TEST_JALR(0xe3729f6c, 0x82fbefc2, 0xe3729f6c, 0x82fbefc2)
    TEST_JALR(0x0a78e944, 0xe8b1a12a, 0x0a78e944, 0xe8b1a12a)
    TEST_JALR(0xdba0a468, 0x44521de4, 0xdba0a468, 0x44521de4)
    TEST_JALR(0x877c99c0, 0x92ec9cd0, 0x877c99c0, 0x92ec9cd0)
    TEST_JALR(0x3f4b1534, 0xaa78dc0e, 0x3f4b1534, 0xaa78dc0e)
    TEST_JALR(0x5a2ba14e, 0x46a0b8e0, 0x5a2ba14e, 0x46a0b8e0)
    TEST_JALR(0xc6cda210, 0xb73d1daa, 0xc6cda210, 0xb73d1daa)
    TEST_JALR(0xfaa69f00, 0x4638b0f0, 0xfaa69f00, 0x4638b0f0)
    TEST_JALR(0x81e337f8, 0x9c82c3a0, 0x81e337f8, 0x9c82c3a0)
    TEST_JALR(0x3e298dc8, 0x02ac6cd8, 0x3e298dc8, 0x02ac6cd8)
    TEST_JALR(0xd365fd70, 0x6a233e98, 0xd365fd70, 0x6a233e98)
    TEST_JALR(0x7f72a67b, 0x47ba67c6, 0x7f72a67b, 0x47ba67c6)
    TEST_JALR(0x30e32f10, 0x028a9ed0, 0x30e32f10, 0x028a9ed0)
    TEST_JALR(0xaa6a2f86, 0x574ea69d, 0xaa6a2f86, 0x574ea69d)
    TEST_JALR(0x6fe20051, 0xe6d286d2, 0x6fe20051, 0xe6d286d2)
    TEST_JALR(0xfb9cfd6d, 0x39ae4860, 0xfb9cfd6d, 0x39ae4860)
    TEST_JALR(0x138b8d70, 0xedd582e5, 0x138b8d70, 0xedd582e5)
    TEST_JALR(0xf1c91b75, 0xc4783b2e, 0xf1c91b75, 0xc4783b2e)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n50_jalr_test)
